/*
 * SmajlPanel.java
 *
 * Created on 26.11.2007, 19:04:06
 *
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.possoft.client.gui.panel.chatpanel.components;

import java.awt.FlowLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author mara
 */
public class SmajlPanel extends JPanel {

    public static final int POCET_SMAJLIKU = 10;
    // index prazdneho smajlika
    public static final int EMPTY_SMAJLIK = 0;
    private static SmajlikButton[] sm = new SmajlikButton[POCET_SMAJLIKU];
    private JTextField chatInputField;

    public SmajlPanel(JTextField chif) {
        FlowLayout fl = new FlowLayout(FlowLayout.LEFT);
        fl.setHgap(0);
        setLayout(fl);

        this.chatInputField = chif;
        for (int i = 0; i < POCET_SMAJLIKU; i++) {
            sm[i] = new SmajlikButton(i, new ImageIcon("smajlici/smajl" + String.valueOf(i) + ".GIF"), chatInputField);
            if (i != EMPTY_SMAJLIK) {
                add(sm[i]);
                add(new JLabel("  "));
            }
        }
    }

    // vraci smajlika podle indexu
    public static ImageIcon getSmajlikButton(int i) {
        return (ImageIcon) sm[i].getIcon();
    }
}
